Dialog Box Question

Hi,

There is a specific type of a DBE that I am looking for and not sure how to go about creating it. In DOORS itself, when you have an enumerated type and double-click on the attribute, a "drop down" list appear that has multiple "check boxes" in which you can choose from and you can have multiple boxes checked. This is what I'm looking to do. In one of my dialog boxes, I have probably close to 20 check boxes and i was looking to reduce the space they take up by compacting all the choices into one list.
Thanks in advance

Eric
Eric_Hillen - Wed Apr 06 09:59:39 EDT 2011

Re: Dialog Box Question
Mathias Mamsch - Wed Apr 06 11:31:57 EDT 2011

In this case you should use a listView element with the option 'listViewOptionCheckboxes'. In the DOORS help and in this forum you will find a couple of examples for using a listView. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: Dialog Box Question
Eric_Hillen - Wed Apr 06 14:10:29 EDT 2011

Mathias Mamsch - Wed Apr 06 11:31:57 EDT 2011
In this case you should use a listView element with the option 'listViewOptionCheckboxes'. In the DOORS help and in this forum you will find a couple of examples for using a listView. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Is there more that needs to be done for this other than simply declaring the dialog box and the listView DBE and then realizing/showing the DB? I have this done and declared a string earlier in the code, but I just get a blank box.

Re: Dialog Box Question
Eric_Hillen - Wed Apr 06 14:42:13 EDT 2011

Eric_Hillen - Wed Apr 06 14:10:29 EDT 2011
Is there more that needs to be done for this other than simply declaring the dialog box and the listView DBE and then realizing/showing the DB? I have this done and declared a string earlier in the code, but I just get a blank box.

My previous post is now irrelevant. I figured it out. What I'm not sure of, but is there a way to have the listView kind of hidden, but once you double-click on it, to have it pop-up like in the DOORS modules?

Re: Dialog Box Question
Mathias Mamsch - Wed Apr 06 17:10:08 EDT 2011

Eric_Hillen - Wed Apr 06 14:42:13 EDT 2011
My previous post is now irrelevant. I figured it out. What I'm not sure of, but is there a way to have the listView kind of hidden, but once you double-click on it, to have it pop-up like in the DOORS modules?

You can use a combo box, but this will only allow you to select one item. If that is not what you want, then stay with the listView. You can make the listView change its size, when the dialog is resized - but don't expect to much from DOORS GUIs, all that fling flang dynamic GUI stuff is very hard to impossible to achieve in DXL, so keep your GUIs simple. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: Dialog Box Question
Eric_Hillen - Wed Apr 06 17:18:16 EDT 2011

Mathias Mamsch - Wed Apr 06 17:10:08 EDT 2011
You can use a combo box, but this will only allow you to select one item. If that is not what you want, then stay with the listView. You can make the listView change its size, when the dialog is resized - but don't expect to much from DOORS GUIs, all that fling flang dynamic GUI stuff is very hard to impossible to achieve in DXL, so keep your GUIs simple. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Alright. This is all in attempt to make the dialog boxes compact so that is why I asked. I also figured since it can be done in DOORS modules, the DXL should be able to replicate it. I think I a just going to create a simple button and have it open up another dialog box that has the listView in it.

Thanks for your help.

Eric.

Re: Dialog Box Question
llandale - Thu Apr 07 10:46:31 EDT 2011

Eric_Hillen - Wed Apr 06 14:42:13 EDT 2011
My previous post is now irrelevant. I figured it out. What I'm not sure of, but is there a way to have the listView kind of hidden, but once you double-click on it, to have it pop-up like in the DOORS modules?

Mathias' advise to K.I.S.S. is good; but if you REALLY want to ignore that here's a possible convoluted approach.

There is a button on the main dialog that "block"s up a secondary dialog that has your list view. I've never done this, but think the following points are valid:

The parent of the ListView dialog is the Main (dbListView = create(dbMain, "ListViewSubDialog")
The Results of the ListView sub-dialog, no doubt what has been selected, need to be stored in some global variable. If its a Multi-List then perhaps a Skip list of results will suffice.
Button on the Main will create and invoke the sub-dialog; first to realize it, 2nd to populate the ListView element; 3rd to 'block' it.
Callbacks on the sub-dialog read the ListView and store the results globally.
Close on the sub-dialog releases the sub-dialog; main code after block destroys it.

  • Louie

There's a point where the 'silk purse/cow's ear' aphorism comes into play and you should accept the restrictions of the tool at hand.

Re: Dialog Box Question
Eric_Hillen - Thu Apr 07 14:07:49 EDT 2011

llandale - Thu Apr 07 10:46:31 EDT 2011
Mathias' advise to K.I.S.S. is good; but if you REALLY want to ignore that here's a possible convoluted approach.

There is a button on the main dialog that "block"s up a secondary dialog that has your list view. I've never done this, but think the following points are valid:

The parent of the ListView dialog is the Main (dbListView = create(dbMain, "ListViewSubDialog")
The Results of the ListView sub-dialog, no doubt what has been selected, need to be stored in some global variable. If its a Multi-List then perhaps a Skip list of results will suffice.
Button on the Main will create and invoke the sub-dialog; first to realize it, 2nd to populate the ListView element; 3rd to 'block' it.
Callbacks on the sub-dialog read the ListView and store the results globally.
Close on the sub-dialog releases the sub-dialog; main code after block destroys it.

  • Louie

There's a point where the 'silk purse/cow's ear' aphorism comes into play and you should accept the restrictions of the tool at hand.

I'm going to investigate into maybe placing a button on a dialog box, witht the listView hidden underneath it, but set to a tiny size, then maybe upon pressing the button, resizing it and showing it, and then maybe have some type of counter that if the button is pressed again, it resizes the box and hide it again?

But currently what I have is a button, that will open up another dialog box that contains my listView and I'm running into a problem.

DB pizzaDB = create "Pizza Box"
DB selectingfeatures = create "Selected Features"
DBE pizzatoppings2
string storedvalues[3] = null
int k = 0

DBE selectbutton
string toppings[] = ("This", "That", "Those")

void on_featuresclose(DB bx){
int i
for(i = 0; sizeof(toppings) > i; i++)
{
//storedvalues[i] ="Checked:" stringOf(getCheck(selectingfeatures,i)) "\n"
storedvalues[i] = getCheck(pizzatoppings2,i) "\n"
if(storedvalues[i] == "true"){
print storedvalues[i]
}
}
hide selectingfeatures

}

void secondtimethrough(){
show selectingfeatures
}

void on_selectbutton(DBE bx){
if(k == 0){
pizzatoppings2 = listView(selectingfeatures, listViewOptionCheckboxes|listViewOptionMultiselect, 150, 10, toppings)
// close(selectingfeatures, true, on_featuresclose)
close(selectingfeatures, true, on_featuresclose)
realize selectingfeatures
insertColumn(pizzatoppings2,0,"Pizzas to Go",150,iconUser)
setSize(selectingfeatures,170,500)
show selectingfeatures
k = k + 1
}else{
secondtimethrough
}
}
selectbutton = button(pizzaDB,"Select Features",on_selectbutton)
realize pizzaDB

show pizzaDB

It's just a dummy example so that I can get the concepts down before implementing it into the actual DXL. I have no issues opening up the initial dialog box, when I click on the "Select Features" button, the listView will pop-up, I am able to choose my options and close the window. If I re-open the window, chose items and hit close, I get an error saying that the DB hasn't been realized. Any ideas? I tried putting in an if statement that would cause the insertColumn to be run the first time only, but this would only cause me to get the same error later in the code.

Thanks in advance

Eric

P.S. if you guys could tell me how to put code into these posts with the color coding, etc I could do that from now on to make it easier to read.

Re: Dialog Box Question
Eric_Hillen - Thu Apr 07 14:11:22 EDT 2011

Eric_Hillen - Thu Apr 07 14:07:49 EDT 2011
I'm going to investigate into maybe placing a button on a dialog box, witht the listView hidden underneath it, but set to a tiny size, then maybe upon pressing the button, resizing it and showing it, and then maybe have some type of counter that if the button is pressed again, it resizes the box and hide it again?

But currently what I have is a button, that will open up another dialog box that contains my listView and I'm running into a problem.

DB pizzaDB = create "Pizza Box"
DB selectingfeatures = create "Selected Features"
DBE pizzatoppings2
string storedvalues[3] = null
int k = 0

DBE selectbutton
string toppings[] = ("This", "That", "Those")

void on_featuresclose(DB bx){
int i
for(i = 0; sizeof(toppings) > i; i++)
{
//storedvalues[i] ="Checked:" stringOf(getCheck(selectingfeatures,i)) "\n"
storedvalues[i] = getCheck(pizzatoppings2,i) "\n"
if(storedvalues[i] == "true"){
print storedvalues[i]
}
}
hide selectingfeatures

}

void secondtimethrough(){
show selectingfeatures
}

void on_selectbutton(DBE bx){
if(k == 0){
pizzatoppings2 = listView(selectingfeatures, listViewOptionCheckboxes|listViewOptionMultiselect, 150, 10, toppings)
// close(selectingfeatures, true, on_featuresclose)
close(selectingfeatures, true, on_featuresclose)
realize selectingfeatures
insertColumn(pizzatoppings2,0,"Pizzas to Go",150,iconUser)
setSize(selectingfeatures,170,500)
show selectingfeatures
k = k + 1
}else{
secondtimethrough
}
}
selectbutton = button(pizzaDB,"Select Features",on_selectbutton)
realize pizzaDB

show pizzaDB

It's just a dummy example so that I can get the concepts down before implementing it into the actual DXL. I have no issues opening up the initial dialog box, when I click on the "Select Features" button, the listView will pop-up, I am able to choose my options and close the window. If I re-open the window, chose items and hit close, I get an error saying that the DB hasn't been realized. Any ideas? I tried putting in an if statement that would cause the insertColumn to be run the first time only, but this would only cause me to get the same error later in the code.

Thanks in advance

Eric

P.S. if you guys could tell me how to put code into these posts with the color coding, etc I could do that from now on to make it easier to read.

I just realized I copied over an earlier version of this code. IGNORE THE ABOVE CODE. USE THE CODE BELOW!
DB pizzaDB = create "Pizza Box"
DB selectingfeatures = create "Selected Features"
DBE pizzatoppings2
string storedvalues[3] = null
int k = 0

DBE selectbutton
string toppings[] = ("This", "That", "Those")

void on_featuresclose(DB bx){
int i
for(i = 0; sizeof(toppings) > i; i++)
{
//storedvalues[i] ="Checked:" stringOf(getCheck(selectingfeatures,i)) "\n"
storedvalues[i] = getCheck(pizzatoppings2,i) "\n"
if(storedvalues[i] == "true"){
print storedvalues[i]
}
}
hide selectingfeatures

}
void on_selectbutton(DBE bx){
pizzatoppings2 = listView(selectingfeatures, listViewOptionCheckboxes|listViewOptionMultiselect, 150, 10, toppings)
// close(selectingfeatures, true, on_featuresclose)
close(selectingfeatures, true, on_featuresclose)
realize selectingfeatures
insertColumn(pizzatoppings2,0,"Pizzas to Go",150,iconUser)
setSize(selectingfeatures,170,500)
show selectingfeatures
}

selectbutton = button(pizzaDB,"Select Features",on_selectbutton)
realize pizzaDB

show pizzaDB

Re: Dialog Box Question
llandale - Thu Apr 07 15:42:06 EDT 2011

Eric_Hillen - Thu Apr 07 14:11:22 EDT 2011
I just realized I copied over an earlier version of this code. IGNORE THE ABOVE CODE. USE THE CODE BELOW!
DB pizzaDB = create "Pizza Box"
DB selectingfeatures = create "Selected Features"
DBE pizzatoppings2
string storedvalues[3] = null
int k = 0

DBE selectbutton
string toppings[] = ("This", "That", "Those")

void on_featuresclose(DB bx){
int i
for(i = 0; sizeof(toppings) > i; i++)
{
//storedvalues[i] ="Checked:" stringOf(getCheck(selectingfeatures,i)) "\n"
storedvalues[i] = getCheck(pizzatoppings2,i) "\n"
if(storedvalues[i] == "true"){
print storedvalues[i]
}
}
hide selectingfeatures

}
void on_selectbutton(DBE bx){
pizzatoppings2 = listView(selectingfeatures, listViewOptionCheckboxes|listViewOptionMultiselect, 150, 10, toppings)
// close(selectingfeatures, true, on_featuresclose)
close(selectingfeatures, true, on_featuresclose)
realize selectingfeatures
insertColumn(pizzatoppings2,0,"Pizzas to Go",150,iconUser)
setSize(selectingfeatures,170,500)
show selectingfeatures
}

selectbutton = button(pizzaDB,"Select Features",on_selectbutton)
realize pizzaDB

show pizzaDB

Embrace your code with {co de} before and after (without the space) to make it easier to read.

Once you "hide" the dialog its no longer "realized", but it must be "realized" in order to set the ListView contents. You also must define the ListView (line 26) BEFORE its realized; but you need to do that exactly once; not in a repeat callback.

Putting your "create" at the top is bad form. Separating the "DB create" from the "DBE define" lines is bad form.

You should create your selectingfeatures dialog all in one function, presumably on_selectbutton(); something like this:

// this block of text was preceded with {co de} (no space)
DB selectingfeatures = null
 
void on_selectbutton(DBE bx){
   if (null selectingfeatures)
   {          // first time called, build the Dialog
      selectingfeatures = create (pizzaDB, "Selected Features")
      pizzatoppings2 = listView(selectingfeatures, listViewOptionCheckboxes|listViewOptionMultiselect, 150, 10, toppings)
      close(selectingfeatures, true, on_featuresclose)
      realize selectingfeatures   // Louie has doubts about this spot for 'realize'
   }
   else
   {          // Dialog already built.  Clear the columns
      realize selectingfeatures   // Louie has doubts about this spot for 'realize'
      delete existing columns from the ListView, if any
   }
   
   insertColumn(pizzatoppings2,0,"Pizzas to Go",150,iconUser)
   setSize(selectingfeatures,170,500)
   show selectingfeatures
}
        // this block of text was followed by {co de} (no space)


If your main dialog had a close callback, put in it this:
... if (!null selectingfeatures) destroy(selectingfeatures)
... hide pizzaDB
... destroy pizzaDB

Seems to me the selectingfeatures should be "blocked", not "shown", since you don't want to be able to go back to the main dialog without selecting something. on_featuresclose() would issue a "release". Notice that by making "pizzaDB" the parent in the "create", it automatically gets put to the front of the screen when the other dialog closes.

 

 

  • Louie


With good coding form you would see errors more easily.

 

 

Re: Dialog Box Question
Eric_Hillen - Thu Apr 07 16:21:41 EDT 2011

llandale - Thu Apr 07 15:42:06 EDT 2011

Embrace your code with {co de} before and after (without the space) to make it easier to read.

Once you "hide" the dialog its no longer "realized", but it must be "realized" in order to set the ListView contents. You also must define the ListView (line 26) BEFORE its realized; but you need to do that exactly once; not in a repeat callback.

Putting your "create" at the top is bad form. Separating the "DB create" from the "DBE define" lines is bad form.

You should create your selectingfeatures dialog all in one function, presumably on_selectbutton(); something like this:

// this block of text was preceded with {co de} (no space)
DB selectingfeatures = null
 
void on_selectbutton(DBE bx){
   if (null selectingfeatures)
   {          // first time called, build the Dialog
      selectingfeatures = create (pizzaDB, "Selected Features")
      pizzatoppings2 = listView(selectingfeatures, listViewOptionCheckboxes|listViewOptionMultiselect, 150, 10, toppings)
      close(selectingfeatures, true, on_featuresclose)
      realize selectingfeatures   // Louie has doubts about this spot for 'realize'
   }
   else
   {          // Dialog already built.  Clear the columns
      realize selectingfeatures   // Louie has doubts about this spot for 'realize'
      delete existing columns from the ListView, if any
   }
   
   insertColumn(pizzatoppings2,0,"Pizzas to Go",150,iconUser)
   setSize(selectingfeatures,170,500)
   show selectingfeatures
}
        // this block of text was followed by {co de} (no space)


If your main dialog had a close callback, put in it this:
... if (!null selectingfeatures) destroy(selectingfeatures)
... hide pizzaDB
... destroy pizzaDB

Seems to me the selectingfeatures should be "blocked", not "shown", since you don't want to be able to go back to the main dialog without selecting something. on_featuresclose() would issue a "release". Notice that by making "pizzaDB" the parent in the "create", it automatically gets put to the front of the screen when the other dialog closes.

 

 

  • Louie


With good coding form you would see errors more easily.

 

 

Some of the places in which things were placed were due to how to my reference showed it so I just went the way it showed me. And the order of things is a little weird due to me getting some funky errors.

But I had a feeling I had to delete the column and then add it back in.

Re: Dialog Box Question
Mathias Mamsch - Thu Apr 07 17:06:44 EDT 2011

Eric_Hillen - Thu Apr 07 16:21:41 EDT 2011
Some of the places in which things were placed were due to how to my reference showed it so I just went the way it showed me. And the order of things is a little weird due to me getting some funky errors.

But I had a feeling I had to delete the column and then add it back in.

I reordered your code a little. As Louie pointed out you must pay attention that you
 

  • create the dialog once, then hide it and show it again
  • destroy and recreate the listview dialog every time the user presses select.


Regards, Mathias

 

 

DB pizzaDB = null 
DBE selectbutton = null
 
 
DB selectingfeatures = null
DBE pizzatoppings2 = null
 
string toppings[] = ("This", "That", "Those")
string storedvalues[3] = null
// int k = 0
 
 
void on_featuresclose(DB bx){
    int i
        print "Selected: "
        for(i = 0; sizeof(toppings) > i; i++)
        {
                if (getCheck(pizzatoppings2,i) ) {
                        string s = getColumnValue(pizzatoppings2, i,0)
                        if (i != 0) print ", "
                        print s 
                }
        }
        print "\n"
 
        hide selectingfeatures
 
}
 
 
// create main dialog
void on_selectbutton(DBE bx){
        if (null selectingfeatures) {
                // create toppings dialog
                // create select dialog as a child of pizzaDB
                selectingfeatures = create (pizzaDB, "Selected Features")
                pizzatoppings2 = listView(selectingfeatures, listViewOptionCheckboxes|listViewOptionMultiselect, 150, 10, toppings)
 
                close(selectingfeatures, true, on_featuresclose)
                realize selectingfeatures
                insertColumn(pizzatoppings2,0,"Pizzas to Go",150,iconUser)
                setSize(selectingfeatures,170,500)
        }
 
        show selectingfeatures
}
 
// create main dialog
pizzaDB = create "Pizza Box"
selectbutton = button(pizzaDB,"Select Features",on_selectbutton)
 
show pizzaDB

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS